package com.winit.common.util;

import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 发送邮件工具类 通过upush发送
 */
public class MailUtil {

    private static final Logger logger = LoggerFactory.getLogger(MailUtil.class);

    private static final String UPUSH_URL = ConfigUtil.getValue("upush_url");


    public static void sendMail(String to, String subject, String body) {
        JSONObject json = new JSONObject();
        json.put("to", to);
        json.put("subject", subject);
        json.put("body", body);
        try {
            HttpClientUtil.doPostForJson(UPUSH_URL, json.toJSONString());
        } catch (Exception e) {
            logger.error("com.winit.common.util.MailUtil.sendMail 异常", e);
        }
    }
}
